import Vue from 'vue'
import VueRouter from 'vue-router'
import NavigationBar from '../views/NavigationBar.vue'
import Guide from '../views/Guide.vue'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Guide
  },
  {
    path: '/navigationBar',
    name: 'NavigationBar',
    component:NavigationBar,
    children: [
      {
        path: '/homepage',
        component: () => import('../components/Homepage.vue')
      },

      {
        path: '/order',
        component: () => import('../components/Order.vue')
      },

      {
        path: '/car',
        component: () => import('../components/Car.vue')
      },

      {
        path: '/setting',
        component: () => import('../components/Setting.vue')
        
      }
    ]
  },
  {
    path: '/login',
    component: Login,
    children:[
      {
        // 默认加载登录组件，所以path为空
        path:'',
        component:()=>import('../components/LoginItem.vue')
      },{
        // /login/register
        path:'register',
        component:()=>import('../components/Register.vue')
      }
    ]
  },
  {
    path:'/change',
      component: () => import('../components/Change.vue')
    },
 
      {
    path:'/navigationBar',
    name:'NavigationBar',
    component:()=>import('../views/NavigationBar.vue'),
 
  },

]

const router = new VueRouter({
  routes
})

export default router
